package com.qcu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qcu.entity.Comment;
import com.qcu.service.CommentService;
import com.qcu.mapper.CommentMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author MyComputer
* @description 针对表【comment】的数据库操作Service实现
* @createDate 2025-02-15 16:55:15
*/
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment>
    implements CommentService{

    @Resource
    CommentMapper commentMapper;

    @Override
    public Page<Comment> getComByPID(Page<Comment> pageParam, String postId) {
        Page<Comment> commentPage = commentMapper.selectPage(pageParam, new LambdaQueryWrapper<Comment>().eq(Comment::getPostId, postId).orderByDesc(Comment::getCreateAt));
        return commentPage;
    }
}




